import 'package:citiesocial/beans/goods_entity.dart';

class ActivityTypeEntity {
  String id, name;

  ActivityTypeEntity.fromJson(dynamic json) {
    if (json != null && json is Map) {
      id = json['id'];
      name = json['name'];
    }
  }
}

class IndexEntity {
  String type, name;

  List<ActicityEntity> list;

  IndexEntity.fromJson(dynamic json) {
    if (json != null && json is Map) {
      type = json['type'];
      name = json['name'];
      var goods = json['list'] as List ?? [];
      list = List();
      for (dynamic g in goods) {
        list.add(ActicityEntity.fromJson(g));
      }
    }
  }
}

class ActicityEntity {
  String activity_id,
      activity_country,
      activity_brand,
      activity_name,
      activity_type_ext,
      finish_time,
      img,
      is_alert;

  List<GoodsEntity> goods_list;

  ActicityEntity.fromJson(dynamic json) {
    if (json != null && json is Map) {
      activity_id = json['activity_id'];
      activity_country = json['activity_country'];
      activity_brand = json['activity_brand'];
      activity_type_ext = json['activity_type_ext'];
      activity_name = json['activity_name'];
      finish_time = json['finish_time'];
      img = json['img'];
      is_alert = json['is_alert'];
      var goods = json['goods_list'] as List ?? [];
      goods_list = List();
      for (dynamic g in goods) {
        goods_list.add(GoodsEntity.fromJson(g));
      }
    }
  }
}

class ActicityDetailEntity {
  String activity_id,
      activity_country,
      brand_name,
      activity_name,
      activity_range_ext,
      finish_time,
      content,
      is_alert;
  List<String> img;

  List<GoodsEntity> goods_list;

  ActicityDetailEntity.fromJson(dynamic json) {
    if (json != null && json is Map) {
      activity_id = json['activity_id'];
      activity_country = json['activity_country'];
      brand_name = json['brand_name'];
      activity_range_ext = json['activity_range_ext'];
      activity_name = json['activity_name'];
      finish_time = json['finish_time'];
      content = json['content'];
      is_alert = json['is_alert'];
      var goods = json['goods_list'] as List ?? [];
      goods_list = List();
      for (dynamic g in goods) {
        goods_list.add(GoodsEntity.fromJson(g));
      }
      var imgs = json['img'] as List;
      img = List();
      for (dynamic i in imgs) {
        img.add(i);
      }
    }
  }
}
